<template>
  <div class="desc-wrap process">
    <BasicTable @register="registerTable">
      <template #bodyCell="{ column, record }">
        <template v-if="column.key === 'action'">
          <TableAction :actions="[
            {
              tooltip: '处理',
              icon: 'clarity:note-edit-line',
              onClick: handleEdit.bind(null, record.id),
            },
          ]" />
        </template>
      </template>
    </BasicTable>
    <ThisModal @register="registerModal" />
  </div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useRouter } from 'vue-router'

import ThisModal from '../modal.vue';
import { TableSchema, searchFormSchema } from '../data';
import { getWorkList } from "/@/api/work/work";

export default defineComponent({
  components: { BasicTable, TableAction },
  setup() {
    //table注册
    const [registerTable] = useTable({
      api: getWorkList,
      columns: TableSchema,
      formConfig: {
        labelWidth: 120,
        schemas: searchFormSchema,
        showAdvancedButton: false,
        showResetButton: false,
        autoSubmitOnEnter: true,
      },
      useSearchForm: true,
      pagination: true,
      showIndexColumn: true,
      actionColumn: {
        title: '操作',
        dataIndex: 'action',
        fixed: false,
      },
    });

    const router = useRouter();

    function handleEdit(id) {
      router.push('/work/view/' + id);
    }

    return {
      registerTable,
      handleEdit
    }
  },
});
</script>

<style lang="less">
.process-list-container {
  .vben-basic-table-form-container {
    padding: 0 !important;
  }
}

.process {
  .vben-basic-table-form-container {
    .ant-form {
      margin-bottom: 0;
    }
  }
}
</style>
